package com.wdj.creation.prototype.pattern.deepclone;

import java.io.IOException;
import java.io.OptionalDataException;

/**
 * @ClassName Client
 * @Description
 * @Author wdj
 * @Date 2020/12/14 21:49
 * @Version 1.0
 **/
public class Client {
    //  实体类一定要序列化， 否则会报空异常问题
    public static void main(String[] args) {
        WeeklyLog log_new = null;
        WeeklyLog log_previous = new WeeklyLog();
        Attachment attachment = new Attachment();
        log_previous.setAttachment(attachment);
        try {
            log_new = log_previous.deepClone();
        } catch (Exception e){
            System.out.println("error");
        }
        System.out.println("周报是否相同？" + (log_previous == log_new));
        System.out.println("附件是否相同？" + (log_previous.getAttachment() == log_new.getAttachment()));
    }
}
